﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WEALTH
{
    public partial class Assets : ClientBasePage
    {
        private ExcuteDao dao = new ExcuteDao();
        protected void Page_Load(object sender, EventArgs e)
        {
            //csCount += int.Parse(Request.Form["select" + i.ToString()].ToString());

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string txtName = Request.Form["txtName"].ToString();
            string txtPhone = Request.Form["txtPhone"].ToString();
            string txtHealth = Request.Form["txtHealth"].ToString();
            string txtCost = Request.Form["txtCost"].ToString();
            string drpWorkType = Request.Form["drpWorkType"].ToString();
            string isMyComp = Request.Form["rad_Company"];

            //收入来源
            string moneyFrom = getCheckBoxValue("chkSRLY", 4);
            string txtMoney = Request.Form["txtMoney"].ToString();
            string drpHomeCost = Request.Form["drpHomeCost"].ToString();
            string txtTZFX = Request.Form["txtTZFX"].ToString();
            string agoBuyList = getCheckBoxValue("chkTouZiAgo", 6);
            string tuoZiGuanZhu = getCheckBoxValue("chkQuestion", 6);
            string ziXunFrom = getCheckBoxValue("chkZiXun", 6);
            string txtTotalMoney = Request.Form["txtTotalMoney"].ToString();
            string txtJYBaozhang = Request.Form["txtJYBaozhang"].ToString();
            string txtGoalEndData = Request.Form["txtGoalEndData"].ToString();
            string txtGoalDesc = Request.Form["txtGoalDesc"].ToString();
            string txtGoalMoney = Request.Form["txtGoalMoney"].ToString();
            string txtGoalDesc2 = Request.Form["txtGoalDesc2"].ToString();
            string yearInMoney = Request.Form["yearInMoney"];
            string yearOutMoney = Request.Form["yearOutMoney"];
            string txtGZ = Request.Form["txtGZ"].ToString();
            string txtKX = Request.Form["txtKX"].ToString();
            string txtWifeMoney = Request.Form["txtWifeMoney"].ToString();
            string txtHospital = Request.Form["txtHospital"].ToString();
            string txtPrize = Request.Form["txtPrize"].ToString();
            string txtEducation = Request.Form["txtEducation"].ToString();
            string txtLiXi = Request.Form["txtLiXi"].ToString();
            string txtBX = Request.Form["txtBX"].ToString();
            string txtRent = Request.Form["txtRent"].ToString();
            string txtQTZC = Request.Form["txtQTZC"].ToString();
            string txtQTSR = Request.Form["txtQTSR"].ToString();
            string txtPayRate = Request.Form["txtPayRate"].ToString();
            string txtSRRate = Request.Form["txtSRRate"].ToString();
            string ziChan = Request.Form["ziChan"];
            string fuZhai = Request.Form["fuZhai"];
            string txtCushType = Request.Form["txtCushType"].ToString();
            string txtGJJ = Request.Form["txtGJJ"].ToString();
            string txtGDSY = Request.Form["txtGDSY"].ToString();
            string txtGRJD = Request.Form["txtGRJD"].ToString();
            string txtFDSY = Request.Form["txtFDSY"].ToString();
            string txtSYZF = Request.Form["txtSYZF"].ToString();
            string txtBDC = Request.Form["txtBDC"].ToString();
            string txtQTFZ = Request.Form["txtQTFZ"].ToString();
            string txtBXType = Request.Form["txtBXType"].ToString();
            string txtQTZCType = Request.Form["txtQTZCType"].ToString();
            string txtKTZGM = Request.Form["txtKTZGM"].ToString();

            if (dao.Insert_ziChanSetting(txtName, txtPhone, txtHealth, txtCost, drpWorkType, isMyComp,
             moneyFrom, txtMoney, drpHomeCost, txtTZFX, agoBuyList,
             tuoZiGuanZhu, ziXunFrom, txtTotalMoney, txtJYBaozhang, txtGoalEndData,
             txtGoalDesc, txtGoalMoney, txtGoalDesc2, yearInMoney, yearOutMoney,
             txtGZ, txtKX, txtWifeMoney, txtHospital, txtPrize,
             txtEducation, txtLiXi, txtBX, txtRent, txtQTZC,
             txtQTSR, txtPayRate, txtSRRate, ziChan, fuZhai,
             txtCushType, txtGJJ, txtGDSY, txtGRJD, txtFDSY,
             txtSYZF, txtBDC, txtQTFZ, txtBXType, txtQTZCType,
             txtKTZGM, "") == -1)
            {
                ReturnList("Assets.aspx", "提交信息成功！稍后我们的理财师会和你联系！谢谢！");

            }
            else
            {
                ShowMsg("添加信息失败，请确认！", 1);
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {

        }

        private string getCheckBoxValue(string cName, int count)
        {
            string str = "";
            for (int i = 1; i <= 12; i++)
            {
                if (!string.IsNullOrEmpty(Request.Form[cName + i.ToString()]))
                {
                    str += "|" + Request.Form[cName + i.ToString()].ToString();
                }
            }

            return str;
        }
    }
}